<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j"
	  xmlns:rich="http://richfaces.org/rich"
	  xmlns:c="http://java.sun.com/jstl/core"
	  xmlns:p="http://primefaces.prime.com.tr/ui">
		<body>
			<rich:modalPanel id="panel" width="520" height="200" moveable="false" resizeable="false">
		        <f:facet name="header">
		            <h:panelGroup>
		                <h:outputText value="#{msg.buscarEquipamento}"></h:outputText>
		            </h:panelGroup>
		        </f:facet>
		        <f:facet name="controls">
		            <h:panelGroup>
		                <h:outputText value="X" id="hidelink"/>
		                <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
		            </h:panelGroup>
		        </f:facet>
				<h:form prependId="false">
					<h:panelGrid columns="2">
							<h:panelGroup>
								<h:outputLabel value="#{msg.codigo}" for="idCodigoEq" />
							</h:panelGroup>
							<h:panelGroup>
								<h:inputText id="idCodigoEq"
									value="#{equipamentoMB.codigoEquipamento}" size="15" maxlength="45"
									onkeyup="javascript:toUpperCase(this);" />
							</h:panelGroup>
							<br />
					</h:panelGrid>
					
					<a4j:commandButton value="#{msg.botaoBuscar}"
										action="#{equipamentoMB.buscarEquipamentos}" style="text-align:center;" reRender="idAjudaEquipamentoList"/>
					<rich:spacer width="5px"/>
					<h:commandButton action="#{ocorrenciaMB.listaAjudaEquipamentoToForm}" value="#{msg.botaoSelecionar}" onclick="#{rich:component('panel')}.hide()">
						<a4j:support event="onclick" reRender="idPanelOcorrencia"/>
					</h:commandButton>
					
					<br />
					<rich:scrollableDataTable id="idAjudaEquipamentoList"
											  rowKeyVar="rkv"
											  value="#{equipamentoMB.ajudaEquipamentoList}" 
											  var="equipamento"
											  rows="1"
											  selection="#{equipamentoMB.equipamentoSelection}"
											  width="508px"
											  height="60px">
						<rich:column>
	                    	<f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.codigo}" /></f:facet>
	                    	<h:outputText value="#{equipamento.codigo}" />
	                	</rich:column>
						<rich:column>
	                    	<f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.nome}" /></f:facet>
	                    	<h:outputText value="#{equipamento.nomeEquipamento.nome}" />
	                	</rich:column>
						<rich:column>
	                    	<f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.sala}" /></f:facet>
	                    	<h:outputText value="#{equipamento.posicao.fileira.sala.nome}" /> 
	                	</rich:column>
						<rich:column>
	                    	<f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.fileira}" /></f:facet>
	                    	<h:outputText value="#{equipamento.posicao.fileira.ordem}" /><h:outputText styleClass="headerText" value="º FILEIRA" />
	                	</rich:column>
						<rich:column>
	                    	<f:facet name="header"><h:outputText styleClass="headerText" value="#{msg.nome}" /></f:facet>
	                    	<h:outputText value="#{equipamento.posicao.posicao}" /><h:outputText styleClass="headerText" value="º POSIÇÃO" />
	                	</rich:column>
					</rich:scrollableDataTable>
				</h:form>
		    </rich:modalPanel>
		</body>
</html>